package com.aaa.kaibi;

import jdk.internal.org.objectweb.asm.util.ASMifier;

public class HuiTu {

    public void drawShape(Shape shape){
        shape.draw();

    }


//        public void drawShape(Shape shape){
//            if(shape.my_tape == 1){
//                drawRectangle(shape);
//            }else if(shape.my_tape == 2){
//                drawCircle(shape);
//// 新增 方法
//            }else if(shape.my_tape == 3){
//                drawTriangle(shape);
//            }
//            else if(shape.my_tape == 4){
//                drawTiXing(shape);
//            }
//        }
//
//    private void drawTiXing(Shape shape) {
//        System.out.println("梯形");
//    }
//
//    //绘制矩形
//    public void drawRectangle(Shape r){
//        System.out.println("矩形");
//    }
//    //绘制圆
//    public void drawCircle(Shape r){
//        System.out.println("圆");
//    }
//    //绘制三角形
//    public void drawTriangle(Shape r){
//        System.out.println("三角形");
//    }
}

abstract class Shape{
    int my_tape;

    public abstract void draw();


}


class Rentclge extends Shape{
    public Rentclge() {
        super.my_tape=1;
    }

    @Override
    public void draw() {
        System.out.println("长方形");
    }


}

class Circle extends Shape{
    public Circle() {
        super.my_tape=2;
    }

    @Override
    public void draw() {
        System.out.println("⚪形");
    }
}

class SanJiaoXing extends Shape{
    public SanJiaoXing() {
        super.my_tape=3;
    }

    @Override
    public void draw() {
        System.out.println("三角形");
    }
}